var a = require("../../utils/config.js");

Page({
    data: {
        list: [],
        page: 1,
        isEnd: !1
    },
    onLoad: function(a) {},
    onReady: function() {},
    onShow: function() {
        this.data.page = 1, this.loadDataSource();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        this.data.page = 1, this.loadDataSource();
    },
    onReachBottom: function() {
        this.data.isEnd || (this.data.page++, this.loadDataSource());
    },
    onShareAppMessage: function() {},
    loadDataSource: function() {
        var t = this;
        1 == this.data.page && (t.setData({
            isEnd: !1
        }), t.data.list = []), wx.request({
            url: a.urlList.API_USER_TASK_FAVORITE_GET_FAVORITE_LIST,
            data: {
                page: t.data.page,
                rows: 10,
                userId: wx.getStorageSync("userId")
            },
            success: function(a) {
                t.setData({
                    list: t.data.list.concat(a.data.data)
                }), a.data.data.length < 10 && (t.data.page--, t.setData({
                    isEnd: !0
                })), wx.stopPullDownRefresh();
            }
        });
    },
    goToDetail: function(a) {
        var t = a.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/pages/task/taskDetail?id=" + t
        });
    }
});